
<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>填写淘宝卡密</title>
  <link href="css/layui.css" rel='stylesheet' media="all">
  <style>
    body{padding:10px; font-size:14px; background:#fff; width:95%; margin:0 auto; font-size:14px; line-height:20px; overflow:hidden;text-align:center}
    p{margin-bottom:10px;}
    input{border:1px solid #999; padding:5px 10px; margin:0 10px 10px 0;}
  </style>
</head>
<body>

<div>
  <!-- <strong><label>淘宝卡密</label></strong> -->
  <div class="000layui-inline" >
    <input class="layui-input" id="name" placeholder="请输入淘宝卡密">
  </div>
</div>


<!--<pre class="layui-code" style="height: 180px; overflow: auto;">
<span class="run">//注意：parent 是 JS 自带的全局对象，可用于操作父页面
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引

 //让层自适应iframe
$('#add').on('click', function(){
    $('body').append('插入很多酱油。插入很多酱油。插入很多酱油。插入很多酱油。插入很多酱油。插入很多酱油。插入很多酱油。');
    parent.layer.iframeAuto(index);
}); 
 //在父层弹出一个层
$('#new').on('click', function(){
    parent.layer.msg('Hi, man', {shade: 0.3})
});
//给父页面传值
$('#transmit').on('click', function(){
    parent.$('#parentIframe').text('我被改变了');
    parent.layer.tips('Look here', '#parentIframe', {time: 5000});
    parent.layer.close(index);
}); 
//关闭iframe
$('#closeIframe').click(function(){
    var val = $('#name').val();
    if(val === ''){
        parent.layer.msg('请输入卡密');
        return;
    }
    parent.layer.msg('您将标记 [ ' +val + ' ] 成功传送给了父窗口');
    parent.layer.close(index);
});
</span>
</pre>-->
<div>
<!--<button class="layui-btn layui-btn-primary" id="add">让层自适应iframe</button>
<button class="layui-btn layui-btn-primary" id="new">在父层弹出一个层</button>
<button class="layui-btn layui-btn-primary" id="transmit">给父页面传值</button>-->
<button class="layui-btn layui-layer-btn0" style="margin:0 auto" id="closeIframe">确定</button>
</div>



<script type="text/javascript" src="js/jquery.min.js"></script>
<!--<script type="text/javascript" src="js/layer/layer.js"></script>-->
<script>
//new Function($('.run').text())()

//var index = parent.layer.getFrameIndex(window.name);
//parent.layer.iframeAuto(index);


var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
//关闭iframe
$('#closeIframe').click(function(){
    var val = $('#name').val();
    if(val === ''){
        parent.layer.msg('请输入卡密');
        return;
    }
    //parent.layer.msg('您将标记 [ ' +val + ' ] 成功传送给了父窗口');
    //parent.$('#parentIframe').text('我被改变了');
    parent.$('#paycardNo').val(val);
    parent.layer.close(index);
    parent.$(".signin").click();
});
</script>


</body>
</html>
